package com.leetcode.No0342;

import org.junit.Test;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

/**
 * @program: leetcode
 * @description:
 * @author: wangzhihua
 * @date: 2021-05-31
 */
public class Solution {

	public boolean isPowerOfFour(int n) {
		int[] nums = new int[]{1, 4, 16, 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824};
		for (int num : nums) {
			if (num == n) {
				return true;
			}
		}
		return false;
	}

	@Test
	public void test01() {
		System.out.println(isPowerOfFour(1));
	}

	public static void main(String[] args) {
		int num = 1;
		ArrayList<Integer> nums = new ArrayList<Integer>();
		nums.add(num);
		while(num > 0) {
			num *= 4;
			nums.add(num);
		}
		System.out.print("{");
		for (Integer n : nums) {
			System.out.print(n + ", ");
		}
		System.out.println("}");
	}

}
